Skip to content

Conversation

yago-123
Copy link

@yago-123 yago-123 commented Sep 3, 2025

Description

This PR onboards the new STACKIT Intake (ticket) service into the CLI.

Intake is composed of three components:

  • Intake Runners: dedicated, isolated runtime data ingestion environment
  • Intakes: a specific data stream or topic within an Intake Runner
  • Intake Users: provides secure access credentials for your applications to connect to your Intake

This PR contains the Intake Runners part only to make a quicker and less overwhelming review. The remaining code (2/3) can be submitted as part of this PR once the first batch has been reviewed/approved or we can open a different PR for it (as the maintainer please).

The commands are designed to work as follows:

$ stackit-cli intake runner create ... 
$ stackit-cli intake create ... 
$ stackit-cli intake user create... 

Most customers will use intakes hence why we decided to go with this command structure. The folder structure will look like the following due to the hierachy desired:

$ ls stackit-cli/internal/cmd/intake
common    
instance    # command for intakes 
intake.go        
runner   
user  

Checklist

  • Issue was linked above
  • Code format was applied: make fmt
  • Examples were added / adjusted (see e.g. here)
  • Docs are up-to-date: make generate-docs (will be checked by CI)
  • Unit tests got implemented or updated
  • Unit tests are passing: make test (will be checked by CI)
  • No linter issues: make lint (will be checked by CI)

@yago-123 yago-123 requested a review from a team as a code owner September 3, 2025 08:34
@yago-123
Copy link
Author

yago-123 commented Sep 3, 2025

Sample CLI usage:

% ./bin/stackit intake runner create --display-name "runner-example" --max-message-size-kib 1024 --max-messages-per-hour 1000 --project-id xxx
Are you sure you want to create an Intake Runner for project "STACKIT Intake PROD"? [y/N] y
Created Intake Runner for project "STACKIT Intake PROD". Runner ID: yyy

% ./bin/stackit intake runner describe yyy  --project-id xxx                                                 
 
 ATTRIBUTE              │ VALUE                                                                 
────────────────────────┼───────────────────────────────────────────────────────────────────────
 ID                     │ yyy                                  
 Name                   │ runner-example                                                        
 Description            │                                                                       
 Max Message Size (KiB) │ 1024                                                                  
 Max Messages/Hour      │ 1000                                                                  
 Ingestion URI          │ yyy.intake.eu01.onstackit.cloud:9094 
 
% ./bin/stackit intake runner list  --project-id xxx          
 
 ID                                   │ NAME           
──────────────────────────────────────┼────────────────
 aaa  │ testyago       
 bbb │ runner1        
 zzz │ mytestrunner   
 ddd │ runner-example 
 fff │ runner1        
 yyy │ test-yago      
 
% ./bin/stackit intake runner update yyy --display-name runner-updated  --project-id xxx
Update request for Intake Runner "yyy" sent successfully.

% ./bin/stackit intake runner delete yyy  --project-id xxx                           
Are you sure you want to delete Intake Runner "yyy"? [y/N] y
Deletion request for Intake Runner "yyy" sent successfully.

@rubenhoenle rubenhoenle added the needs-work PR needs work from author. label Sep 4, 2025
@yago-123 yago-123 requested a review from rubenhoenle September 8, 2025 10:57
@yago-123
Copy link
Author

PS: notice that I messed up the branch by mistake, I had to cherry-pick until 7868e56 (last commit reviewed) and force push.

return fmt.Errorf("update Intake Runner: %w", err)
}

p.Printer.Info("Update request for Intake Runner %q sent successfully.\n", model.RunnerId)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will produce invalid JSON/YAML output in case the --output-format flag is set.

`Update the message capacity limits for an Intake Runner with ID "xxx"`,
`$ stackit intake runner update xxx --max-message-size-kib 2000 --max-messages-per-hour 10000`),
examples.NewExample(
`Clear the labels of an Intake Runner with ID "xxx" by providing an empty value`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`Clear the labels of an Intake Runner with ID "xxx" by providing an empty value`,

I guess we have to get rid of this example for now, it gives me the following error:

➜  stackit-cli git:(669dbb92) stackit intake runner update xxx --labels ""
Error: invalid argument "" for "--labels" flag:  must be formatted as key=value
exit status 1

This is related to the discussion where I told you we as maintainers of this repo will take care of, sorry for that again 😅

cmd.Flags().Int64(maxMessageSizeKiBFlag, 0, "Maximum message size in KiB. Note: Overall message capacity cannot be decreased.")
cmd.Flags().Int64(maxMessagesPerHourFlag, 0, "Maximum number of messages per hour. Note: Overall message capacity cannot be decreased.")
cmd.Flags().String(descriptionFlag, "", "Description")
cmd.Flags().StringToString(labelFlag, nil, "Labels in key=value format. To clear all labels, provide an empty string, e.g. --labels \"\"")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cmd.Flags().StringToString(labelFlag, nil, "Labels in key=value format. To clear all labels, provide an empty string, e.g. --labels \"\"")
cmd.Flags().StringToString(labelFlag, nil, "Labels in key=value format.")

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Edit, maybe better:

Suggested change
cmd.Flags().StringToString(labelFlag, nil, "Labels in key=value format. To clear all labels, provide an empty string, e.g. --labels \"\"")
cmd.Flags().StringToString(labelFlag, nil, "Labels in key=value format, separated by commas. Example: --labels \"key1=value1,key2=value2\"")


region := viper.GetString(config.RegionKey)
cfgOptions := []sdkConfig.ConfigurationOption{
sdkConfig.WithRegion(region),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add the header with the CLI version here, like described in our contribution guide:

utils.UserAgentConfigOption(cliVersion),

)

// ConfigureClient creates and configures a new Intake API client
func ConfigureClient(p *print.Printer) (*intake.APIClient, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
func ConfigureClient(p *print.Printer) (*intake.APIClient, error) {
func ConfigureClient(p *print.Printer, cliVersion string) (*intake.APIClient, error) {

return fmt.Errorf("delete Intake Runner: %w", err)
}

p.Printer.Outputf("Deletion request for Intake Runner %q sent successfully.\n", model.RunnerId)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, invalid JSON/YAML output in case the --output-format flag is set to JSON/YAML.

`$ stackit intake runner update xxx --display-name "new-runner-name"`),
examples.NewExample(
`Update the message capacity limits for an Intake Runner with ID "xxx"`,
`$ stackit intake runner update xxx --max-message-size-kib 2000 --max-messages-per-hour 10000`),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example produces an error for me:

stackit intake runner update 4db8fc33-22e0-47cd-9574-8615055750f6 --max-message-size-kib 2000 --max-messages-per-hour 10000
Error: update Intake Runner: 400 Bad Request, status code 400, Body: {"message":"invalid maximum message size - should be lower or equal to  1024"}


exit status 1

@rubenhoenle
Copy link
Member

Rest looks good to me. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-work PR needs work from author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants